package com.utils;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;

import java.io.IOException;

/**
 * Created by tancw on 2017/2/13.
 */
public class HttpUtil {
    private static final OkHttpClient client = new OkHttpClient();

    public static String get(String url) {
        Request request = new Request.Builder().url(url).build();
        Response response = null;
        try {
            response = client.newCall(request).execute();
            if (response.isSuccessful()) return response.body().string();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
